package com.ywy.bootadmin.elfinder.configuration;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
@ConfigurationProperties(prefix = "file-manager")
public class ElfinderConfiguration {
    protected Thumbnail thumbnail; //缩略图配置

    protected List<Space> workspaces; // 工作空间（目录）

    public Thumbnail getThumbnail() {
        return thumbnail;
    }

    public void setThumbnail(Thumbnail value) {
        this.thumbnail = value;
    }

    public List<Space> getWorkspaces() {
        if (workspaces == null) {
            workspaces = new ArrayList<Space>();
        }
        return this.workspaces;
    }

    public void setWorkspaces(List<Space> workspaces) {
        this.workspaces = workspaces;
    }

    public int getThumbnailWidth() {
        int thumbnailWidth = 80; //default value
        if (this.getThumbnail() != null) {
            thumbnailWidth = this.getThumbnail().getWidth().intValue();
        }
        return thumbnailWidth;
    }

}
